package com.example.springbootsfzy.service.sunkaixuan;


import com.example.springbootsfzy.domain.CourseFavorites;
import com.example.springbootsfzy.domain.CoursePayments;
import com.example.springbootsfzy.mapper.CourseFavoritesMapper;
import com.example.springbootsfzy.mapper.CoursePaymentsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CourseFavoriteService {

    @Autowired
    private CourseFavoritesMapper courseFavoritesMapper;

    //查询所有课程收藏
    public List<CourseFavorites> findAll() {
        return courseFavoritesMapper.findAll();
    }

    //通过memberid查
    public List<CourseFavorites> selectByMemberId(Integer memberId) {
        return courseFavoritesMapper.selectByMemberId(memberId);
    }

    public List<CourseFavorites> selectByPrimaryKey(Integer id) {
        return courseFavoritesMapper.selectByPrimaryKey(id);
    }

    public int insertSelective(CourseFavorites courseFavorites) {
        return courseFavoritesMapper.insertSelective(courseFavorites);
    }

    public int updateByPrimaryKeySelective(CourseFavorites courseFavorites) {
        return courseFavoritesMapper.updateByPrimaryKeySelective(courseFavorites);
    }

    public int deleteByPrimaryKey(int id) {
        return courseFavoritesMapper.deleteByPrimaryKey(id);
    }

    //通过courseid和memberid删除
    public int deleteByCourseIdAndMemberId(Integer courseId, Integer memberId) {
        return courseFavoritesMapper.deleteByCourseIdAndMemberId(courseId, memberId);
    }

}
